package com.chartboost.sdk.impl;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import com.chartboost.sdk.Chartboost;
import java.net.URI;
import java.net.URISyntaxException;

public class m
{
  public a a;

  public m(a parama)
  {
    this.a = parama;
  }

  private void b(String paramString, Context paramContext)
  {
    if (this.a != null)
      this.a.a(paramString);
    if (paramContext == null)
      paramContext = Chartboost.sharedChartboost().getContext();
    if (paramContext == null);
    while (true)
    {
      return;
      try
      {
        Intent localIntent1 = new Intent("android.intent.action.VIEW");
        if (!(paramContext instanceof Activity))
          localIntent1.addFlags(268435456);
        localIntent1.setData(Uri.parse(paramString));
        paramContext.startActivity(localIntent1);
        return;
      }
      catch (Exception localException1)
      {
        try
        {
          if (paramString.startsWith("market://"))
          {
            String str = "http://market.android.com/" + paramString.substring(9);
            Intent localIntent2 = new Intent("android.intent.action.VIEW");
            if (!(paramContext instanceof Activity))
              localIntent2.addFlags(268435456);
            localIntent2.setData(Uri.parse(str));
            paramContext.startActivity(localIntent2);
            return;
          }
        }
        catch (Exception localException2)
        {
        }
      }
    }
  }

  public void a(final String paramString, final Context paramContext)
  {
    try
    {
      URI localURI = new URI(paramString);
      String str = localURI.getScheme();
      if (str == null)
        return;
      if ((!str.equals("http")) && (!str.equals("https")))
      {
        b(paramString, paramContext);
        return;
      }
      new AsyncTask()
      {
        // ERROR //
        public String a(Void[] paramAnonymousArrayOfVoid)
        {
          // Byte code:
          //   0: aconst_null
          //   1: astore_2
          //   2: new 31	java/net/URL
          //   5: dup
          //   6: aload_0
          //   7: getfield 21	com/chartboost/sdk/impl/m$1:b	Ljava/lang/String;
          //   10: invokespecial 34	java/net/URL:<init>	(Ljava/lang/String;)V
          //   13: invokevirtual 38	java/net/URL:openConnection	()Ljava/net/URLConnection;
          //   16: checkcast 40	java/net/HttpURLConnection
          //   19: astore 5
          //   21: aload 5
          //   23: iconst_0
          //   24: invokevirtual 44	java/net/HttpURLConnection:setInstanceFollowRedirects	(Z)V
          //   27: aload 5
          //   29: ldc 46
          //   31: invokevirtual 50	java/net/HttpURLConnection:getHeaderField	(Ljava/lang/String;)Ljava/lang/String;
          //   34: astore 8
          //   36: aload 8
          //   38: ifnonnull +9 -> 47
          //   41: aload_0
          //   42: getfield 21	com/chartboost/sdk/impl/m$1:b	Ljava/lang/String;
          //   45: astore 8
          //   47: aload 5
          //   49: ifnull +8 -> 57
          //   52: aload 5
          //   54: invokevirtual 53	java/net/HttpURLConnection:disconnect	()V
          //   57: aload 8
          //   59: areturn
          //   60: astore 4
          //   62: aconst_null
          //   63: astore 5
          //   65: aload 5
          //   67: ifnull +8 -> 75
          //   70: aload 5
          //   72: invokevirtual 53	java/net/HttpURLConnection:disconnect	()V
          //   75: aconst_null
          //   76: areturn
          //   77: astore_3
          //   78: aload_2
          //   79: ifnull +7 -> 86
          //   82: aload_2
          //   83: invokevirtual 53	java/net/HttpURLConnection:disconnect	()V
          //   86: aload_3
          //   87: athrow
          //   88: astore 7
          //   90: aload 5
          //   92: astore_2
          //   93: aload 7
          //   95: astore_3
          //   96: goto -18 -> 78
          //   99: astore 6
          //   101: goto -36 -> 65
          //
          // Exception table:
          //   from	to	target	type
          //   2	21	60	java/lang/Exception
          //   2	21	77	finally
          //   21	36	88	finally
          //   41	47	88	finally
          //   21	36	99	java/lang/Exception
          //   41	47	99	java/lang/Exception
        }

        public void a(String paramAnonymousString)
        {
          m.a(m.this, paramAnonymousString, paramContext);
        }
      }
      .execute(new Void[0]);
      return;
    }
    catch (URISyntaxException localURISyntaxException)
    {
    }
  }

  public static abstract interface a
  {
    public abstract void a(String paramString);
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.chartboost.sdk.impl.m
 * JD-Core Version:    0.6.2
 */